<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/14
 * Time: 14:07
 */
namespace  Admin\Controller;

use Admin\Model\DoctorInfoModel;
use Admin\Model\FriendInfoModel;
use Admin\Model\PatientInfoModel;
use Base\Controller\CurdController;

class FriendInfoController extends CurdController{
    public  function  __construct()
    {
        parent::__construct();
    }
    protected function getAll()
    {
        $data = $this->model->pageToView(20);
        $this->assign("page", $data['page']);
        $this->assign("list", $data['list']);
    }
    public  function  aeid(){
          $DoctorInfoModel =new DoctorInfoModel();
          $info= $this->model->select();
          foreach ($info as $k=>$v){
               $docinfo=$DoctorInfoModel->where(array('id'=>$v['user']))->find();
               if($docinfo) {
                   $where['id']=$v['id'];
                   $where['usertype']=0;
                   $this->model->save($where);
               }else{
                   $where['id']=$v['id'];
                   $where['usertype']=1;
                   $this->model->save($where);
               }
          }
          $this->success('ok');
    }
}